<template>
    <div>
      <el-table :data="companyList"  id="tab" >
         <el-table-column type="expand">
              <template slot-scope="props">
                <el-form label-position="left" inline class="demo-table-expand">
                  <el-form-item label="公司ID">
                    <span>{{ props.row.id }}</span>
                  </el-form-item>
                  <el-form-item label="公司名称">
                    <span>{{ props.row.companyName }}</span>
                  </el-form-item>
                  <el-form-item label="公司电话">
                    <span>{{ props.row.phone }}</span>
                  </el-form-item>
                  <el-form-item label="公司简介">
                    <span>{{ props.row.description }}</span>
                  </el-form-item>
                  <el-form-item label="公司创建时间">
                    <span>{{ props.row.creationTime }}</span>
                  </el-form-item>

                </el-form>
              </template>
            </el-table-column>
        <el-table-column label="公司名称" prop="companyName"></el-table-column>
      	<el-table-column label="公司电话" prop="phone"></el-table-column>
      	<el-table-column label="公司简介" prop="description"></el-table-column>
        <el-table-column  prop="id">
          <template slot-scope="scope">
           <div @click="unShelve(scope)">
             <a href="#">
               <p>
                审核通过
               </p>
             </a>
           </div>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination layout="total,prev,pager,next,jumper,sizes"
      :total="page.total"
      :page-size="page.pageSize"
      :current-page="page.pageNum"
      :page-sizes="page.pageSizes"
      @current-change="currentPage"
      @size-change="changeSizes"
      >
      </el-pagination>
    </div>
</template>

<script>
  import {getList,upState} from '@/api/logisticsManage.js'
   export default {
    data(){
      return{
        companyList:[],
        page:{
        	pageNum:1,
        	pageSize:2,
          total:0,
          pageSizes:[1,2]
        },
        id:0,
        exc:1
      }
    },
    methods:{
      unShelve(param){
        this.id = param.row.id
        let params ={
          id:this.id,
          exc:this.exc
        }
        upState(params).then(result => {
          alert(result.data.message)
          this.initList()
        })
      },
    initList(){
      let param ={
        pageNum:this.page.pageNum,
        pageSize:this.page.pageSize,
      }
      getList(param).then(result => {
        this.companyList = result.data.list,
        this.page.total = result.data.total
      })
    },
    currentPage(value){
      this.page.pageNum =value
      this.initList(this.page.pageNum)
    },
    changeSizes(value){
      this.page.pageSize =value
      this.initList(this.page.pageSize)
    }

    },
    beforeMount(){
      this.initList()
    }
  }
</script>
<style>
  .demo-table-expand {
    font-size: 0;
  }
  .demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }
  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 50%;
  }
</style>
